﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="spread_logon.aspx.cs" Inherits="Spread_spread_logon" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
    <script type="text/javascript" src="../js/jquery-1.6.1.js"></script>
    <script type="text/javascript">

      $(function(){
      function Logon()
      {
         var username=$("#username").val();
         var password=$("#password").val();
         var checkcode=$("#checkcode").val();
         $.ajax({
                async:false,
                url:'API/A_Spreadlogon.aspx',
                type:'POST',
                data:{edit:'logon',u:username,p:password,c:checkcode},
                dataType:'json',
                success:function(data){
                  switch(data.err)
                  {
                    case "t":
                       {
                          window.location="spread_info.aspx?u="+username;
                          break;
                       }
                       case "p":
                         {
                           alert("用户名密码错误");
                           break;
                         }
                         case "c":
                           {
                             alert("验证码错误");
                             break;
                           }
                           default:break;
                  }
               }
         });
      }
      $("#logonbt").click(function(){
                Logon();
      });
     function CheckImage()
      {
        var verify = document.getElementById("checkimage");
        verify.src='../API/A_SecurityCode.aspx?t='+Math.random(); 
      }
      })
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       <input id="username" type="text"/>
       <input id="password" type="password" />
       <input id="checkcode" type="text" />
       <img id="checkimage" alt="验证码" src="../API/A_SecurityCode.aspx" onclick="CheckImage()" style="cursor:pointer" />
       <input id="logonbt" type="button" value="登录" />
    </div>
    </form>
</body>
</html>
